﻿using Autofac;
using DataLayer.Model;
using DataLayer.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DataLayer
{
    internal class IocContanier
    {
        public static IContainer Current { get; private set; }

        static IocContanier()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType<CheerMessageRepository>().PropertiesAutowired();
            builder.RegisterType<FitbitAccountRepository>().PropertiesAutowired();
            builder.RegisterType<IndoorExercisePersonalRepository>().PropertiesAutowired();
            builder.RegisterType<MessageRepository>().PropertiesAutowired();
            builder.RegisterType<PlayerGroupRepository>().PropertiesAutowired();
            builder.RegisterType<PlayerRepository>().PropertiesAutowired();
            builder.RegisterType<SetTobBoxRepository>().PropertiesAutowired();

            builder.RegisterType<GameUPContext>().PropertiesAutowired().InstancePerOwned<UnitOfWork>();
            builder.RegisterType<UnitOfWork>().PropertiesAutowired();

            Current = builder.Build();
        }
    }
}
